package com.jdd.modules.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jdd.modules.system.entity.SysRole;
import com.jdd.modules.system.mapper.SysRoleMapper;
import com.jdd.modules.system.service.ISysRoleService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * <p>
 * 角色表 服务实现类
 * </p>
 *
 * @Author scott
 * @since 2018-12-19
 */
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {


    @Override
    public boolean removeByIds(List<String> ids, String orgCode) {
        LambdaQueryWrapper<SysRole> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(SysRole::getId,ids);
        if(StringUtils.isEmpty(orgCode))
        {
            queryWrapper.isNull(SysRole::getSysProjectCode);
        }else {
            queryWrapper.eq(SysRole::getSysProjectCode,orgCode);
        }
        return this.remove(queryWrapper);
    }
}
